;;; khaki-theme.el --- Emacs khaki theme

;; Author: alexander.kuzin@undervision.net

;;; Code:

(deftheme khaki
  "Emacs khaki theme")

(let ((yellow-1 "#fce94f")
      (yellow-2 "#edd400")
      (yellow-3 "#c4a000")
      (green-1  "#8ae234")
      (green-2  "#4e9a06")
      (green-3  "#354829")
      (green-4  "#095809")
      (red-1    "#ef2929")
      (red-3    "#a40000")
      (red-4    "#800000")
      (grey-1   "#eeeeec")
      (grey-2   "#d0d0d0")
      (grey-3   "#babdb6")
      (grey-4   "#888a85")
      (grey-5   "#5f615c")
      (grey-6   "#2e3436")
      (blue-1   "#0011FF")
      (blue-2   "#050466")
      (brown-1  "#663604")
      (orange-1 "#b35000")
      (olive "#cdd2a7")
      (olive-dark "#374a3f")
      
      (back-darker  "#cacaca")
      
      (back         "#dadada")
      (back-light   "#eaeaea")
      (back-lighter "#fafafa")
      (black        "black")
      (org-heading-bg "#d5d5d5")

      ;; (back-darker  "#b2bd82")
      ;; (back         "#c2cd9b")
      ;; (back-light   "#d2ddab")
      ;; (back-lighter "#e2edbb")
      ;; (black        "black")

      ;; (org-heading-bg "#b8c58a")
      )
  
  (custom-theme-set-faces
   'khaki

   ;; Global
   `(default ((t (:background  ,back :foreground  ,black))))
   `(region ((t :background  ,grey-4 )))
   `(minibuffer-prompt ((t :background  nil :foreground ,blue-2 :weight bold)))
   `(cursor ((t :background "#204a87")))

   ;; Highlight
   `(fringe ((t :background nil)))
   `(highlight ((t :background ,grey-3)))
   `(isearch ((t :background ,yellow-3 :foreground ,black)))
   `(line-number-current-line ((t :foreground ,grey-5 :weight bold)))

   ;; Ivy
   `(ivy-current-match ((t :background ,blue-2 :foreground ,grey-2 :weight bold)))
   `(ivy-minibuffer-match-face-1 ((t :background ,yellow-1 :foreground ,black :weight bold)))
   `(ivy-minibuffer-match-face-2 ((t :background ,yellow-2 :foreground ,black :weight bold)))
   `(ivy-minibuffer-match-face-3 ((t :background ,yellow-3 :foreground ,black :weight bold)))
   `(ivy-minibuffer-match-face-4 ((t :background ,yellow-3 :foreground ,black :weight bold)))

   ;; Swiper
   `(swiper-line-face ((t :background ,yellow-1 :foreground ,black)))
   `(swiper-match-face-1 ((t :background ,yellow-2 :foreground ,black)))
   `(swiper-match-face-2 ((t :background ,yellow-3 :foreground ,black)))
   `(swiper-match-face-3 ((t :background ,yellow-3 :foreground ,black)))
   `(swiper-match-face-4 ((t :background ,yellow-3 :foreground ,black)))
   `(swiper-background-match-face-1 ((t :background ,yellow-1 :foreground ,black)))
   `(swiper-background-match-face-2 ((t :background ,yellow-2 :foreground ,black)))
   `(swiper-background-match-face-3 ((t :background ,yellow-3 :foreground ,black)))
   `(swiper-background-match-face-4 ((t :background ,yellow-3 :foreground ,black)))

   ;; Code
   `(font-lock-string-face ((t :foreground ,green-4 :weight normal)))
   `(font-lock-keyword-face ((t :foreground ,blue-2 :weight bold :underline nil)))
   `(font-lock-variable-name-face ((t :foreground ,black :weight normal :slant normal :underline nil)))
   `(font-lock-function-name-face ((t :foreground ,brown-1 :weight normal)))
   `(font-lock-type-face ((t :foreground ,blue-2 :weight normal :underline nil)))
   `(font-lock-constant-face ((t :foreground ,red-4 :weight normal :slant normal )))
   `(font-lock-comment-face ((t :foreground ,grey-6 :weight normal)))
   
   ;; Company
   `(company-tooltip ((t :background ,back-darker :weight normal)))
   `(company-tooltip-selection ((t :background ,grey-4 :weight normal)))
   `(company-scrollbar-bg ((t :background ,grey-3 :weight normal)))
   `(company-scrollbar-fg ((t :background ,grey-5 :weight normal)))

   ;; Flycheck
   `(warning ((t :foreground ,orange-1 :weight normal)))
   `(error ((t :foreground ,red-3 :weight normal)))
   `(success ((t :foreground ,green-2 :weight normal)))

   ;; Flymake
   `(flymake-warning ((t :underline '(:color  "#edd400" :style wave))))

   ;; Mail
   `(gnus-header-content ((t :foreground ,black :weight normal )))
   `(gnus-header-name ((t :foreground ,blue-2 :weight bold)))
   `(gnus-header-from ((t :foreground ,green-3 :weight bold)))
   `(message-header-name ((t :foreground ,blue-2 :weight bold)))
   `(message-cited-text ((t :foreground ,grey-5 :weight normal :slant italic)))
   `(mu4e-header-highlight-face ((t :background ,back-darker :weight bold :underline t)))

   ;; Diff
   `(magit-diff-context-highlight ((t :backend ,grey-1 :weight normal )))
   `(magit-diff-context ((t :background nil :weight normal)))
   `(magit-diff-added ((t :background ,green-2 :foreground ,black :weight normal)))
   `(magit-diff-added-highlight ((t :background ,green-1 :foreground ,black :weight normal)))
   `(magit-diff-removed ((t :background ,red-3 :foreground ,black :weight normal)))
   `(magit-diff-removed-highlight ((t :background ,red-1 :foreground ,black :weight normal)))
   `(magit-section-highlight ((t :background ,back-darker :foreground ,black :weight normal)))

   ;; Org
   `(org-block-begin-line ((t :background ,org-heading-bg :foreground ,grey-5
                              :underline ,back-darker :extend t)))
   `(org-block-end-line ((t :background ,org-heading-bg :foreground ,grey-5
                            :overline ,back-darker :extend t)))
   `(org-block ((t :background ,back-light :foreground ,black :extend t)))
   `(org-level-1 ((t :foreground ,blue-2 :background ,back-light :overline t :weight bold :height 1.2 :extend t)))
   `(org-level-2 ((t :foreground ,brown-1 :background nil :overline t :weight bold :height 1.0 :extend t)))
   `(org-level-3 ((t :foreground ,blue-2 :overline t :weight bold :height 1.0)))
   `(org-level-4 ((t :overline t :weight bold)))
   `(org-level-5 ((t :overline t :weight bold)))
   `(org-checkbox ((t  :weight bold :background ,back-darker)))
   `(org-table ((t :foreground ,blue-1 :background ,back-light)))

   ;; Parens
   `(show-paren-match ((t :background ,back :foreground ,black :underline t :weight bold)))

   ;; Misc
   `(header-line ((t :background ,back-darker)))

   ;; Mode line
   `(mode-line ((t :background ,grey-2 :box '(:line-width -1 :style 'released-button))))
   `(mode-line-inactive ((t :background ,grey-4 :box '(:line-width -1 :style 'released-button))))

   ;; Indentation mode
   `(highlight-indentation-face ((t :background ,back-darker)))

   ;; Pulse
   `(pulse-highlight-start-face ((t :background ,back-lighter)))
   ;`( ((t )))

   )

  ;; Beacon
  (setq beacon-color back-lighter)
  

  ;; HL mode
  (global-hl-line-mode -1)
  
  ;;;###autoload
(when load-file-name
  (add-to-list 'custom-theme-load-path
               (file-name-as-directory (file-name-directory load-file-name)))
  (when (not window-system)
    (custom-set-faces '(default ((t (:background nil))))))))

(provide-theme 'khaki)


